<template>
  <div class="bg_view">
    <div class="billBox">
      <template v-if="invoiceList.length > 0">
        <div class="bill_box" @click="goInvoiceDetail(item.pictureneturl)" v-for="item in invoiceList">
          <div class="bill_box_img" v-if="item.pictureneturl">
            查看详情<img src="@/assets/img/right.png" alt="">
          </div>
          <div class="bill_box_1">
            <div style="font-weight: bold;">业务流水号：{{ item.invoiceNo }}</div>
            <img src="@/assets/img/invoice_1.png" alt="" class="bill_box_1_status" v-if="item.state == '未开票'">
            <img src="@/assets/img/invoice_2.png" alt="" class="bill_box_1_status" v-if="item.state == '开票'">
            <img src="@/assets/img/invoice_3.png" alt="" class="bill_box_1_status" v-if="item.state == '作废'">
          </div>
          <div class="bill_box_2">
            <div class="left">
              <div>电子发票号：{{ item.billno }}</div>
              <div>科室：{{ item.deptName }}</div>
              <div>医生：{{ item.doctName }}</div>
              <div style="font-size: 0.875rem">
                金额：<span style="color: #f72d23">￥{{ item.totCost }}</span>
              </div>
              <div>费用类别：{{ item.feeType }}</div>
              <div class="gery">费用日期：{{ item.feeDate }}</div>
              <div class="gery">开票时间：{{ item.createtime }}</div>
            </div>
          </div>
        </div>
      </template>

      <div class="noresult" v-else>
        <img src="@/assets/img/img_no results@2x.png" alt=""/>
        <div>暂无发票信息</div>
      </div>
    </div>
  </div>
</template>
<script>
import {Tab, TabItem} from "vux";
import {getElecInvoiceInfo} from "@/api/api";

export default {
  components: {
    Tab,
    TabItem,
  },
  data() {
    return {
      info: {},
      invoiceList: [],
    };
  },
  created() {
    this.info = this.$route.query
    this.getElecInvoiceInfo();
  },
  methods: {
    getElecInvoiceInfo() {
      getElecInvoiceInfo({
        clinicCode: this.info.clinicCode
      }).then((res) => {
        if (res.code == 200) {
          this.invoiceList = [];
          if (res.data.elecinvoiceList instanceof Array) {
            this.invoiceList = res.data.elecinvoiceList;
          } else {
            this.invoiceList.push(res.data.elecinvoiceList);
          }
          if (this.invoiceList.length > 0) {
            this.noData = false;
          }
        }
      });
    },
    goInvoiceDetail(url) {
      if (url) {
        window.location.href = url;
      }
    },
  }
};
</script>
<style scoped>
.billBox {
  width: 100%;
  height: 100%; /*calc(100vh - 2.75rem);*/
  overflow-y: scroll;
  background: #f4f8fc;
  /* padding: 1rem 0; */
  position: relative;
}

.bill_box {
  margin: 0.75rem 1rem;
  padding: 0px 1rem;
  width: calc(100% - 4rem);
  /* height: 10.5rem; */
  padding-bottom: 0.75rem;
  background-color: #ffffff;
  box-shadow: 0px 0px 10px 0px rgba(174, 206, 254, 0.24);
  border-radius: 0.375rem;
  position: relative;
}

.bill_box .bill_box_1 {
  height: 2.8125rem;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e7ecf5;
}

.bill_box_1_status {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 4.5rem;
  height: 3.5rem;

}

.bill_box .bill_box_2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bill_box .bill_box_2 .left {
  width: calc(100%);
  /* height: 7.5rem; */
  display: flex;
  /* align-items: center; */
  justify-content: space-around;
  flex-flow: column;
}

.bill_box .bill_box_2 .left > div {
  line-height: 25px;
}


.bill_box .bill_box_2 .left .gery {
  font-size: 0.75rem;
  color: #a4adbe;
}

.bill_box .bill_box_2 .paybtn {
  width: 3.4375rem;
  height: 1.875rem;
  border: 1px solid #448eff;
  border-radius: 3px;
  color: #448eff;
  text-align: center;
  line-height: 1.875rem;
}

.payBottom {
  width: 100%;
  height: 3.4375rem;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  bottom: 0;
}

.payBottom_1 {
}

.payBottom_1 span {
  color: #f62d40;
}

.payBottom_2 {
  height: 3.4375rem;
  width: 8.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, #448eff 0%, #66a3ff 100%);
  font-size: 18px;
  font-family: PingFang SC;
  font-weight: bold;
  color: #ffffff;
}

.bill_box_img {
  position: absolute;
  top: 37%;
  right: 1rem;
  color: #A4ADBE;
}

.bill_box_img img {
  width: 0.5rem;
  height: 0.8125rem;
  margin-left: 0.625rem;

}

.noresult {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-flow: column;
  height: 31.25rem;
}

.noresult img {
  display: block;
  width: 12.5rem;
  height: 9.75rem;
}
</style>
<style>
.weui-dialog__btn_primary {
  color: #448eff;
}
</style>
